<html>
	<head>
		<title>飞网后台管理系统</title>
		<link rel="stylesheet" type="text/css" href="ext/index.css" />
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<script type="text/javascript" src="ext/ext-base.js"></script>
		<script type="text/javascript" src="ext/ext-all.js"></script>
		<script src="js/index.js"></script>
<script type="text/javascript">

function dosubmit(){

	var uname = document.getElementById('uname').value;
	var pwd = document.getElementById('pwd').value;
	var randcode = document.getElementById('randc').value;

	if(uname.replace(/(^\s*)|(\s*$)/g,"")==''){
	alert('请填写用户名');
	return;
	}
	if(pwd.replace(/(^\s*)|(\s*$)/g,"")==''){
	alert('请填写密码');
	return;
	}

	if(randcode.replace(/(^\s*)|(\s*$)/g,"")==''){
	alert('请输入验证码');
	return;
	}

 Ext.Ajax.request({
                  url : 'ajaxjsp/login.jsp?rtmd='+new Date().getTime(),
                  method : 'POST',
                  loadMask: 'please wait...',
                  params : {
                      username : uname,
                      password : pwd,
                      randCode : randcode
                  },
                  success: function(response, options) {
                        //获取响应的json字符串
                       var responseArray = Ext.util.JSON.decode(response.responseText);
                            if(responseArray.success==true){
								window.location.href = 'jsps/forward.jsp?rtmda='+new Date().getTime();
                            }
                            else{
                            	newVCode();
                            	document.getElementById('pwd').value ='';
                            	document.getElementById('randc').value='';
                                alert(responseArray.errors.msg);
                            }
                         }
              });

}

function newVCode()
    {
        url="image.jsp?updatetime="+new Date().getTime();
        document.getElementById("vcode").src=url;
    }


</script>
	</head>

	<body onLoad="doLoad()" scroll="no">
		<table height="160">
			<tr>
				<td></td>
			</tr>
		</table>
		<table width="400" class="login" cellspacing="0" cellpadding="0"
			align="center">
			<tr>
				<td class="caption">
					飞网短信业务管理系统 - 用户登陆
				</td>
			</tr>
			<tr>
				<td>
					<img src="images/login.gif" width="400" height="80">
				</td>
			</tr>
			<tr>
				<td class="login">
					<form name="loginForm" method="post" action="" id="lgf">
						<table class="full" cellspacing="0" cellpadding="2" align="center">
							<tr>
								<td width="50" nowrap>
									用户名:
								</td>
								<td align="center">
									<input name="username" type="text" size="40" maxlength="40"
										value="" onFocus="select()" id="uname">
								</td>
								<td width="50">
									&nbsp;
								</td>
							</tr>
							<tr>
								<td nowrap>
									密码:
								</td>
								<td align="center">
									<input name="password" type="password" size="40" maxlength="40"
										onFocus="select()" id="pwd">
								</td>
								<td>
									&nbsp;
								</td>
							</tr>
							<tr>
								<td nowrap>
									验证码:
								</td>
								<td align="center">
									<input name="randCode" type="text" size="40" maxlength="40"
										onFocus="select()" id="randc">
								</td>
								<td>
									&nbsp;
								</td>
							</tr>
							<tr>
								<td nowrap>
									&nbsp;
								</td>
								<td align="center">
									<img src="image.jsp" alt="" id="vcode" />
									<a href="#" onclick="newVCode()">点击刷新验证码</a>
								</td>
								<td>
									&nbsp;
								</td>
							</tr>
						</table>
						<table class="full" cellspacing="0" cellpadding="6" align="center">
							<tr>
								<td class="msg" nowrap></td>
								<td align="right" nowrap>
									<input type="button" class="button" value="   确定   "
										onclick="dosubmit()" style="cursor:hand">
									<input type="reset" class="button" value="   取消   " style="cursor:hand">
								</td>
							</tr>
						</table>
					</form>
				</td>
			</tr>
			<tr>
				<td class="bottom">
					Power By yht
				</td>
			<tr>
		</table>
	</body>
</html>